package com.realtyManage.springboot.Controller;

import com.alibaba.fastjson.JSON;
import com.realtyManage.springboot.Model.Do.Order;
import com.realtyManage.springboot.Service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.*;

/**
 * 杭州素色网络科技有限公司
 * 2019.08.08
 * 订单信息控制器
 */

@Controller
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private IOrderService orderService;

    /**
     * 保存订单信息
     * @param order
     * @param request
     * @return
     */
    @RequestMapping(value = "/saveOrder" ,method = RequestMethod.POST)
    private String saveOrder(Order order, HttpServletRequest request){
        order.setOrderTime(new Date());
        return JSON.toJSONString(orderService.saveOrder(order));
    }
}
